<template>
    <div class="about">
        <!-- <h1>This is an about page</h1>
        <h1>{{ $store.state.num }}</h1>
        <button @click="handleClick">按钮</button> -->

        <el-table :data="tableData" style="width: 100%">
            <el-table-column type="selection" width="55"> </el-table-column>
            <el-table-column type="index" width="50"> </el-table-column>
            <!-- <el-table-column prop="id" label="ID"> </el-table-column> -->
            <el-table-column prop="title" label="标题"> </el-table-column>
            <el-table-column prop="content" label="内容"> </el-table-column>
            <el-table-column prop="create_time" :formatter="formatterDate" label="创建时间">
            </el-table-column>
            <el-table-column prop="delete_time" label="删除时间"> </el-table-column>
        </el-table>
    </div>
</template>
<script>
import { getList, getDetail } from '@/api/index.js';
// import { formatDate } from '@/utils/index.js';
import mixins from '@/utils/mixins.js';
export default {
    mixins: [mixins],  
    data() {
        return {
            tableData: [],
        };
    },

    methods: {
        formatterDate(row, column) {
            return this.formatDate(new Date(row.create_time), 'yyyy-MM-dd');
        },
        handleClick() {
            this.$store.state.num = 100;
        },
        getList() {
            // this.$http.get('http://macio.ncyateng.com/api/news/index',).then((res) => {
            //     console.log(res);
            // });

            // 获取新闻列表
            getList({ id: 1 }).then((res) => {
                let {
                    data: { newsList },
                } = res;
                this.tableData = newsList;
            });

            // getDetail().then((res) => {
            //     console.log(res);
            // });
        },
    },
    created() {
        // console.log(mixins);
        console.log(this);
        this.getList();
    },
};
</script>
